/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package be.ugent.medirem.logic;

import be.ugent.medirem.persistence.entity.details.MedicationDetails;
import be.ugent.medirem.persistence.entity.details.UnitDetails;
import be.ugent.medirem.persistence.entity.values.MedicationValues;
import be.ugent.medirem.persistence.exception.EntityNotFoundException;
import be.ugent.medirem.persistence.exception.UnitNotFoundException;
import java.util.List;
import javax.annotation.security.PermitAll;
import javax.annotation.security.RolesAllowed;
import javax.ejb.Remote;

/**
 *
 * @author Thomas Roelens <thomas.roelens@ugent.be>
 */
@Remote
public interface MedicationRemote {

    /**
     * MedicationDao
     */
    @RolesAllowed("gp")
    Long createMedication(MedicationValues details) throws IllegalArgumentException, EntityNotFoundException;

    @RolesAllowed("gp")
    void removeMedication(Long medicationId) throws IllegalArgumentException;

    @RolesAllowed("gp")
    void updateMedication(Long medicationId, MedicationValues details) throws IllegalArgumentException, EntityNotFoundException;

    @RolesAllowed({"gp", "patient"})
    MedicationDetails getMedicationDetails(Long medicationId) throws IllegalArgumentException, EntityNotFoundException;

    @RolesAllowed("gp")
    List<MedicationDetails> searchMedication(String medicationName);

    @RolesAllowed("gp")
    List<MedicationDetails> getAllMedications();

    /**
     * UnitDao
     */
    @RolesAllowed("gp")
    Long createUnit(String name) throws IllegalArgumentException;

    @RolesAllowed("gp")
    void removeUnit(Long id) throws IllegalArgumentException, UnitNotFoundException;

    @RolesAllowed("gp")
    UnitDetails getUnit(Long id) throws IllegalArgumentException;

    @RolesAllowed("gp")
    List<UnitDetails> getAllUnits();

}
